extends Node

# 存档文件的放置路径
const SAVE_CONFIG_FILE = "res://SaveConfig.save"
const SAVE_GAME_FILE = "res://SaveGame.save"


# 游戏设置信息，存档数据
var config = {
	"master_vol" : 0.50,
	"bgm_vol" : 0.50,
	"btnSound_vol" : 0.50,
	"sfx_vol" : 0.50,
	"screen_size" : 0,
	"screen_mode" : 0,
}


# 玩家信息
var player = {
	"血量" : 50,
	"等级" : 50,
	"位置" : {
		"x" : 100,
		"y" : 200
	}
}

# 存config数据
func SaveConfig(config:Dictionary):
	var file = FileAccess.open(SAVE_CONFIG_FILE, FileAccess.WRITE)
	var data = JSON.stringify(config)
	file.store_line(data)


# 读config数据
func LoadConfig():
	var file = FileAccess.open(SAVE_CONFIG_FILE, FileAccess.READ)
	if FileAccess.file_exists(SAVE_CONFIG_FILE):
		return JSON.parse_string(file.get_line())
	else:
		return false


# 存player数据
func SaveGame_Player():
	pass


# 读player数据
func LoadGame_Player():
	pass
